package com.example.hydrogengenerator.ui.frag

import android.os.Bundle
import com.example.hydrogengenerator.R
import com.example.hydrogengenerator.base.BaseFragment
import com.example.hydrogengenerator.databinding.FragHomeBinding
import com.example.hydrogengenerator.databinding.FragSettingBinding
import com.example.hydrogengenerator.model.HomeModel
import com.example.hydrogengenerator.model.SettingModel
import me.hgj.jetpackmvvm.ext.nav
import me.hgj.jetpackmvvm.ext.navigateAction

class SettingFrag : BaseFragment<SettingModel, FragSettingBinding>() {
    override fun layoutId(): Int = R.layout.frag_setting

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.volumProgress.setMax(15)
        mDatabind.model = mViewModel
        mDatabind.toolbar.setNavigationOnClickListener {
            mViewModel.save()
            appViewModel.settingInfo.value = mViewModel.settingData.value
            nav().navigateUp()
        }
        mDatabind.tvFactorySetting.setOnClickListener {
            nav().navigateAction(R.id.factorySettingFrag)
        }
    }
}